package com.help10000.rms.mvp.presenter

import com.amir.common.api.CustomObserver
import com.amir.common.beans.CompanyEntity
import com.amir.common.mvp.model.Model
import com.amir.common.mvp.presenter.BasePresenter
import com.amir.common.utils.Constant
import com.amir.common.utils.SPUtils
import com.help10000.rms.mvp.view.CompanyListView

open class CompanyListPresenter(view: CompanyListView) : BasePresenter<CompanyListView>(view) {


    fun companyList() {
        val accountid = SPUtils.getString(Constant.accountid)
        val accessToken = SPUtils.getString(Constant.AccessToken)
        val loginCompanyList = Model.getServer().LoginCompanyList(accessToken!!, "6666", accountid)
        Model.getObservable(loginCompanyList, object : CustomObserver<CompanyEntity>(mvpView) {

            override fun success(t: CompanyEntity) {
                mvpView?.companyListData(t)
            }
        })
    }
}